package www.bd.com.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import org.springframework.data.jpa.repository.Query;
import www.bd.com.pojo.Problem;

import java.util.List;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface ProblemDao extends JpaRepository<Problem,String>,JpaSpecificationExecutor<Problem>{
	@Query(value = "select * from tb_problem,tb_pl where id=problemid and labelid=? order by replytime desc",nativeQuery = true)
    public List<Problem> newList(String labelid, Pageable pageable);
	@Query(value = "select * from tb_problem,tb_pl where id=problemid and labelid=? order by reply desc",nativeQuery = true)
	public List<Problem> hotList(String labelid, Pageable pageable);
	@Query(value = "select * from tb_problem,tb_pl where id=problemid and labelid=? and reply=0 order by replytime desc",nativeQuery = true)
	public List<Problem> waitList(String labelid, Pageable pageable);
}
